<div id="play" >
	<ul style="list-style:none;padding:0;margin:0;clear:left">
        <li id="playBg"></li>
        <li id="playText"></li>
        <li id="playNum"><?php foreach($models as $n=>$val):?><a><?php echo $n+1;?></a><?php endforeach;?></li>
        <li id="playShow">
            <?php foreach($models as $val):?>
            <a href="?r=news/get_news&id=<?php echo $val->id;?>" target="_blank" style="display:none"><img src="<?php echo $val->pic1;?>" title="<?php echo $val->title;?>"></a> 
            <?php endforeach;?>
        </li>
    </ul>
</div>
<script type=text/javascript>
var t = n = 0, count = $("#playShow a").size();
$(function(){
$("#playShow a::first-child").show();
//$("#playShow a:not(:first-child)").hide();
$("#playText").html($("#playShow a:first-child").find("img").attr('title'));
$("#playNum a:first").css({"background":"#FFD116",'color':'#A8471C'});
$("#playText").click(function(){window.open($("#playShow a:first-child").attr('href'), "_blank")});
$("#playNum a").click(function() {
   var i = $(this).text() - 1;
   n = i;
   if (i >= count) return;
   $("#playText").html($("#playShow a").eq(i).find("img").attr('title'));
   $("#playText").unbind().click(function(){window.open($("#playShow a").eq(i).attr('href'), "_blank")})
   $("#playShow a").filter(":visible").hide().parent().children().eq(i).fadeIn(1200);
   $(this).css({"background":"#FFD116",'color':'#A8471C'}).siblings().css({"background":"#D7D6D7",'color':'#000'});
});
t = setInterval("showAuto()", 2000);
$("#play").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 2000);});
})
function showAuto()
{
n = n >= (count - 1) ? 0 : ++n;
$("#playNum a").eq(n).trigger('click');
}
</script>